home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / d86bios4.zip / XBIOS.8 < prev    next >
Text File  |  1989-07-07  |  20KB  |  564 lines

  1. ;---------------
  2. ;  XBIOS test driver for BIOS.8
  3. ;---------------
  4.  
  5. ; Copyright 1987-88 Eric Isaacson.  All rights reserved.  Permission to
  6. ; copy and use this module is granted ONLY for machines registered for both
  7. ; the A86 assembler and the D86 debugger.
  8.  
  9. ; XBIOS is a program that exercises the BIOS.8 module.    I am providing it
  10. ; to assist those who wish to assist me in porting my D86 debugger to
  11. ; machines with non-IBM-compatible BIOSes.
  12. ;
  13. ; You may simulate the "B" switch of the D86 debugger by providing a digit
  14. ; in the command tail.  The digit must follow the single space following
  15. ; the XBIOS name; e.g. XBIOS 9 for Sirius/Victor.
  16.  
  17. ; You use this source module as follows:
  18. ;
  19. ;  1. Modify the module BIOS.8 to accommodate your specific machine.  You
  20. ;     should NOT need to modify this module, except possibly to add a
  21. ;     new HELP-key name just before the declcaration HELP_HELP below.
  22. ;
  23. ;  2. Assemble both modules with the command  A86 XBIOS.8 BIOS.8
  24. ;     (Command is provided as MAKX.BAT in this package; just type MAKX.)
  25. ;
  26. ;  3. Run the resulting program XBIOS.COM.  The program will run tests
  27. ;     of the BIOS function calls, and tell you about them.  If everything
  28. ;     looks good, then your BIOS.8 probably works.
  29. ;
  30. ;  4. The XBIOS program ends with an interactive mode, displaying keystrokes.
  31. ;     Please try every key on your keyboard, both with and without any
  32. ;     shift-style keys (ALT, SHIFT, CTRL, SECOND, etc.).  Write down the
  33. ;     codes that result.
  34. ;
  35. ;  5. Send me the codes you wrote down, together with your new BIOS.8.  I'll
  36. ;     incorporate it into D86.    Thanks!
  37.  
  38.  
  39.  
  40. ; This is a "quick-and-dirty" program.  It does not meet my standards for
  41. ; professionally-documented source code (no procedure-level comments).
  42.  
  43.  
  44. JMP MAIN
  45.  
  46. ALTF10_HELP:        ; HELP-key name for the IBM-PC
  47.   DB 'Alt-F10',0
  48. F11_HELP:        ; HELP-key name for the TI-PC
  49.   DB 'F11',0
  50. PF5_HELP:
  51.   DB 'Ctrl-PF5',0
  52. ALTJ_HELP:
  53.   DB 'Alt-J',0
  54. MENU_HELP:
  55.   DB 'Menu',0
  56.  
  57. ; If your machine uses a different HELP-KEY, declare its name above this line.
  58.  
  59. HELP_HELP:
  60.   DB 'HELP',0
  61.  
  62. SWITCH EQU B[$-'A']
  63.   DB 26 DUP 080
  64.  
  65. EGA_ATTRS   DW  04D1F     ; attribute bytes for EGA video
  66. CGA_ATTRS   DW  0F007     ; attribute bytes for CGA video
  67.  
  68. LAST_LINE    DW ?         ; variable stored by the D86 BIOS interface
  69. ENABLE_PORT  DW ?      ; BIOS specific, used by Wang for a port number
  70. V_FLAG         DB ?      ; debugger variable consulted by IBM BIOS_INIT
  71. WAVY_COUNT   DB ?      ; count of how many wavy messages have been output
  72.  
  73. ; DWB causes the initialization of alternating words and bytes
  74.  
  75. DWB MACRO #RX1L
  76.   DW #X
  77.   DB #AX
  78. #E2#EM
  79.  
  80. SKIP2 MACRO    ; skip over the following 2 opcode bytes
  81.   DB 03D       ; CMP AX,iw opcode will do the job
  82. #EM
  83.  
  84.  
  85. SCREEN_P EQU 08000  ; screen buffer is at 08000
  86.  
  87. ; The following are convenient prefix-abbreviations for returned key-codes.
  88.  
  89. CTRL EQU -040       ; e.g. CTRL'A'  -- WARNING CTRL'a' will be wrong!!
  90. FUNC EQU 59+111     ; e.g. FUNC 1 for the F1 function key
  91. SHIFT_F EQU 84+111  ; e.g. SHIFT_F 3 for the shifted F3 key
  92. CTRL_F EQU 94+111   ; e.g. CTRL_F 10 for the control-F10 key
  93. ALT_F EQU 104+111   ; e.g. ALT_F 4 for the Alt-F4 key
  94. ALT_N EQU 120+111   ; e.g. ALT_N 5 for the Alt-5 key
  95.  
  96. BIOS_CALLS:              ; pointers to BIOS-specific action routines
  97.   VID_COPY    DW MONO_COPY  ; video copy
  98.   VID_ATTR    DW IBM_ATTR   ; set attribute at DI to AL
  99.   VID_FIX    DW IBM_FIX    ; fix video screen
  100.   BIOS_BELL    DW IBM_BELL   ; ring bell
  101.   BIOS_KEY    DW IBM_KEY    ; fetch a keystroke
  102.   BIOS_SAVE     DW IBM_SAVE   ; save user's BIOS state (Sanyo only)
  103.   BIOS_RESTORE    DW IBM_RESTORE; restore the saved BIOS state (Sanyo only)
  104.   VIDEO_SEG    DW ?          ; pointer to physical video display segment
  105.   ATTR_BYTES    DW          ; hardware-dependent video codes
  106.    NORM_ATTR    DB 7          ; code for normal video display
  107.    REV_ATTR    DB 070          ; code for reversed-video display
  108. N_BIOS_CALLS EQU ($-BIOS_CALLS)/2
  109.  
  110.  
  111. ; CTRL_JUMPS defines the single-key commands recognized by the debugger.  Each
  112. ;   DW below is an address to be jumped to whenever the following DB byte is
  113. ;   taken as a single-key input by the debugger command processor.
  114.  
  115. CTRL EQU -040
  116.  
  117. CTRL_JUMPS:
  118.   DWB  F1_MSG,        FUNC 1
  119.   DWB  F2_MSG,        FUNC 2
  120.   DWB  F3_MSG,        FUNC 3
  121.   DWB  F4_MSG,        FUNC 4
  122.   DWB  F5_MSG,        FUNC 5
  123.   DWB  F6_MSG,        FUNC 6
  124.   DWB  F7_MSG,        FUNC 7
  125. N_FUNCS EQU ($-CTRL_JUMPS)/3
  126.  
  127. L1:                ; control-key functions start here
  128.   DWB  DOWN_MSG,    80+112
  129.   DWB  PGDN_MSG,    81+112
  130.   DWB  UP_MSG,        72+112
  131.   DWB  PGUP_MSG,    73+112
  132.   DWB  HOME_MSG,    71+112
  133.   DWB  SHF7_MSG, SHIFT_F 7
  134.   DWB  ALTF9_MSG,  ALT_F 9
  135. N_CONTROL_KEYS EQU ($-L1)/3
  136.  
  137.          DW F10_MSG
  138. SWITCH_KEY   DB FUNC 10   ; key code for FUNC 10 (switch screens)
  139.  
  140.          DW HELP_HELP
  141. HELP_KEY     DB ALT_F 10  ; key code for the debugger's HELP key
  142.  
  143.   DWB  0,        0FF     ; terminator for this table
  144.  
  145.  
  146.  
  147.  
  148.  
  149. MAIN:
  150.   CALL XBIOS_SWITCH     ; scan the command-tail switch, if any
  151.   CALL BIOS_INIT    ; initialize our specific BIOS
  152.   MOV DS,ES,SS        ; restore segment registers
  153.   CALL TEST_INIT    ; display the settings produced, prompt for key
  154.   CALL TEST_KEY_BELL    ; test the simple key input and bell functions
  155.   CALL TEST_VIDEO    ; test some simple video displays
  156.   CALL TEST_KEY_CODES    ; enter the interactive key-code display loop
  157.   MOV AX,04C00        ; MS-DOS codes for successful program exit
  158.   INT 33        ; exit back to the operating system
  159.  
  160.  
  161. FIRST_TESTING:
  162.   DB 'Survived BIOS_INIT.',0D,0A
  163.   DB 'Subdirectory character is set to "'
  164. SUBDIR_CHAR  DB '\'
  165.   DB '".',0D,0A
  166.   DB 'Video memory is at segment register value '
  167. VIDEO_DISPLAY:
  168.   DB 'xxxx.',0D,0A
  169.   DB 'The normal attribute byte is '
  170. NORM_DISP:
  171.   DB 'xx.',0D,0A
  172.   DB 'The reverse attribute byte is '
  173. REV_DISP:
  174.   DB 'xx.',0D,0A
  175.   DB 'The HELP key is labelled ',0
  176.  
  177. HELP_MSG     DW ALTF10_HELP
  178.  
  179. POST_HELP:
  180.   DB '.',0D,0A
  181.   DB 'Is this right?',0D,0A,0D,0A
  182.   DB 'First testing BIOS key input and bell-ringing.',0D,0A,0
  183.  
  184. TEST_INIT:        ; make initial display of BIOS variables
  185.   MOV BX,VIDEO_SEG    ; fetch the video segment register value
  186.   MOV DI,VIDEO_DISPLAY    ; point to it position in the display message
  187.   MOV AL,BH        ; fetch the high byte of the value
  188.   CALL HEX_AL        ; output the high byte
  189.   MOV AL,BL        ; fetch the low byte of the value
  190.   CALL HEX_AL        ; output the low byte
  191.   MOV DI,NORM_DISP    ; point to NORM_ATTR value in message
  192.   MOV AL,NORM_ATTR    ; fetch the value
  193.   CALL HEX_AL        ; put the hex value into the message
  194.   MOV DI,REV_DISP    ; point to REV_ATTR value in message
  195.   MOV AL,REV_ATTR    ; fetch the value
  196.   CALL HEX_AL        ; put the hex value into the message
  197.   MOV SI,FIRST_TESTING    ; point to the first message
  198.   CALL MESSAGE        ; output the message
  199.   MOV SI,HELP_MSG    ; point to the name of the HELP key
  200.   CALL MESSAGE        ; output the name
  201.   MOV SI,POST_HELP    ; point to the message after the HELP name
  202.   JMP MESSAGE        ; output the message
  203.  
  204. XBIOS_SWITCH:
  205.   MOV AX,[081]          ; fetch the command-tail switch, if any
  206.   CMP AL,0D             ; is there a command tail?
  207.   JE RET                ; return if not
  208.   MOV AL,AH
  209.   SUB AL,'0'            ; reduce digit to its binary value
  210.   JC RET                ; return if there was not a digit
  211.   MOV SWITCH'B',AL      ; there was a digit: set the B switch to its value
  212.   RET
  213.  
  214.  
  215. VID_TEST_MSG:
  216.   DB 'Now we''ll output directly to video memory.',0D,0A
  217.   DB 'Type any two keys--',0D,0A
  218.   DB 'The screen will go blank after the first keystroke.',0D,0A,0
  219.  
  220. ALPHABET_MSG:
  221.   DB 'Now letters A to X go down the left.',0
  222. H_MSG:
  223.   DB 'Reverse video on the H.',0
  224. AFTER_M_MSG:
  225.   DB 'Reverse video in second character beyond the M.',0
  226.  
  227. H_SPOT EQU  ('H'-'A') * 160
  228. AFTER_M_SPOT EQU ('M'-'A') * 160 + 4
  229.  
  230. TEST_VIDEO:
  231.   MOV SI,VID_TEST_MSG   ; point to the "Now testing video" message
  232.   CALL MESSAGE        ; output the message
  233.   CALL KEY_ONLY     ; take a keystroke
  234.   CALL FIRST_FILL    ; blank the screen
  235.   CALL GET_KEY        ; take another keystroke
  236.   CALL ALPHA_LINES    ; put out the alphabet along the side
  237.   MOV SI,ALPHABET_MSG    ; point to message telling about it
  238.   CALL TOP_